<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link href="images/reset.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<link href="images/system.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<link href="images/table_form.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="js/admin_public.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/ueditor/ueditor.config.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/ueditor/ueditor.all.min.js?v={yun:}$config.cachecode{/yun}"></script>
 <link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet">
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/phpyun_layer.js?v={yun:}$config.cachecode{/yun}"></script>
<script language="javascript">
function checkpost(){
	if($("#name").val()==""){
		parent.layer.msg('课程名称不能为空！', 2, 8);return (false);
 	}
	if($("#tnid").val()==""){
		parent.layer.msg('请选择课程类别！',2,8);return (false);
	}
	if($("#cityidid").val()==""){
		parent.layer.msg('请选择培训地点！',2,8);return (false);
	}
	if($("#address").val()==""){
		parent.layer.msg('培训地址不能为空！',2,8);return (false);
	}
 	if($("#hours").val()==""){
		parent.layer.msg('课程学时不能为空！',2,8);return (false);
	}
	if($("#price").val()==""){
		parent.layer.msg('培训费用不能为空！',2,8);return (false);
	}
	if($("#isprice_val").val()==""){
		parent.layer.msg('请选择收费方式！',2,8);return (false);
	}
	if($("#moblie").val()==""){
		parent.layer.msg('报名电话不能为空！',2,8);return (false);
	}

	if(isjsTell($("#moblie").val())==false&&isjsMobile($("#moblie").val())==false){
		layer.msg('报名电话格式错误！',2,8);return false;
	}

	if($("#crowd").val()==""){
		parent.layer.msg('适合人群不能为空！',2,8);return (false);
	}
	 
	var html = UE.getEditor('myEditor').getContent();
	if(html==""){
		parent.layer.msg('课程介绍不能为空！',2,8);return (false);
	}
	var str =[];
	$('input[name="type[]"]:checked').each(function(){
		str.push($(this).val());
	});
	if(str==''){
		layer.msg('请选择开课类型！',2,8);return false;
	}
	var teachid =[];
	$('input[name="teachid[]"]:checked').each(function(){
		teachid.push($(this).val());
	});   
	$("#subjectform").submit();
}
var weburl="{yun:}$config.sy_weburl{/yun}";
</script>
<style>
* {
	margin: 0;
	padding: 0;
}
body, div {
	margin: 0;
	padding: 0;
}
.layui-form-item{ margin-bottom:0px;}
</style>
<title>后台管理</title>
</head>
<body class="body_ifm">
<div class="infoboxp">
<div class="admin_new_tip">
<a href="javascript:;" class="admin_new_tip_close"></a>
<a href="javascript:;" class="admin_new_tip_open" style="display:none;"></a>
<div class="admin_new_tit"><i class="admin_new_tit_icon"></i>操作提示</div>
<div class="admin_new_tip_list_cont">
<div class="admin_new_tip_list">该页面展示了网站培训课程信息。</div>
</div>
</div>


   <div class="tag_box mt10">
    <iframe id="supportiframe"  name="supportiframe" onload="returnmessage('supportiframe');" style="display:none"></iframe>
    <form id="subjectform" class="layui-form"  name="myform" method="post" target="supportiframe" action="index.php?m=admin_subject&c=save" enctype="multipart/form-data">
      <input type="hidden" name="pytoken" id="pytoken" value="{yun:}$pytoken{/yun}">
      <table width="100%" class="table_form" style="background:#fff;">
       <tr>
              <td colspan="4" bgcolor="#f0f6fb"><div class="admin_bold">培训课程信息</div></td>
            </tr>
        <tr>
          <th><div style="width:135px;">课程名称：</div></th>
          <td><input type="text" name="name" id="name" value="{yun:}$row.name{/yun}" class="input-text"></td>
        </tr>
        <tr class="admin_table_trbg" >
          <th>课程类别：</th>
          <td>
			<div class="layui-form-item">
			<div class="layui-input-inline">
            <select name="nid" id="nid" lay-filter="nid">
              <option value="">请选择</option>
              {yun:}foreach from=$subject_index key=j item=v{/yun}
              <option value="{yun:}$v{/yun}" {yun:}if $row.nid == $v{/yun} selected{yun:}/if{/yun}
                >{yun:}$subject_name[$v]{/yun}
              </option>
              {yun:}/foreach{/yun}
            </select>
          </div>
          <div class="layui-input-inline">
            <select name="tnid" lay-filter="tnid" id="tnid">
              <option value="">请选择</option>
              {yun:}foreach from=$subject_type[$row.nid] key=j item=v{/yun}
              <option value="{yun:}$v{/yun}" {yun:}if $row.tnid==$v{/yun} selected{yun:}/if{/yun}
                >{yun:}$subject_name[$v]{/yun}
              </option>
              {yun:}/foreach{/yun}
            </select>
          </div>
        </div> 
            </td>
        </tr>
        <tr >
          <th>培训地点：</th>
          <td>
		   <div class="layui-form-item">
          <div class="layui-input-inline">
            <select name="provinceid" id="provinceid" lay-filter="citys">
              <option value="">请选择</option>
              {yun:}foreach from=$city_index key=j item=v{/yun}
              <option value="{yun:}$v{/yun}" {yun:}if $row.provinceid == $v{/yun} selected{yun:}/if{/yun}
                >{yun:}$city_name[$v]{/yun}
              </option>
              {yun:}/foreach{/yun}
            </select>
          </div>
          <div class="layui-input-inline">
            <select name="cityid" lay-filter="citys" id="cityid">
              <option value="">请选择</option>
              {yun:}foreach from=$city_type[$row.provinceid] key=j item=v{/yun}
              <option value="{yun:}$v{/yun}" {yun:}if $row.cityid==$v{/yun} selected{yun:}/if{/yun}
                >{yun:}$city_name[$v]{/yun}
              </option>
              {yun:}/foreach{/yun}
            </select>
          </div>
          <div class="layui-input-inline">
            <select name="threecityid" lay-filter="threecityid" id="three_cityid">
              <option value="">请选择</option>
              {yun:}foreach from=$city_type[$row.cityid] key=j item=v{/yun}
              <option value="{yun:}$v{/yun}" {yun:}if $row.threecityid==$v{/yun} selected{yun:}/if{/yun}
                >{yun:}$city_name[$v]{/yun}
              </option>
              {yun:}/foreach{/yun}
            </select>
          </div>
        </div>  
            </td>
        </tr>
        <tr class="admin_table_trbg" >
          <th width="120">培训地址：</th>
          <td><input type="text" value="{yun:}$row.address{/yun}" name="address" id="address" class="input-text"></td>
        </tr>
        <tr >
          <th width="120">课程学时：</th>
          <td><input type="text" value="{yun:}$row.hours{/yun}"  name="hours" id="hours" class="input-text"></td>
        </tr>
        <tr class="admin_table_trbg" >
          <th width="120">培训费用：</th>
          <td><input type="text" value="{yun:}$row.price{/yun}" name="price" id="price" class="input-text"></td>
        </tr>
        <tr class="admin_table_trbg" >
          <th>收费方式：</th>
          <td>
				<div class="layui-form-item">
				 <div class="layui-input-block">
					<div class="layui-input-inline">
						<select name="isprice" id="isprice" lay-verify="" >
								<option>请选择</option>
								<option value="1" {yun:}if $row.isprice=='1'{/yun}selected{yun:}/if{/yun}>在线支付</option>
							   <option value="2"  {yun:}if $row.isprice=='2'{/yun}selected{yun:}/if{/yun}>到场支付</option>
							</select>
						  </div>
						</div>
				  </div>

            </td>
        </tr>
        <tr >
          <th width="120">报名电话：</th>
          <td><input type="text" value="{yun:}$row.moblie{/yun}" onkeyup="this.value=this.value.replace(/[^0-9-]/g,'')"  name="moblie" id="moblie" class="input-text"></td>
        </tr>
        <tr class="admin_table_trbg" >
          <th width="120">适合人群：</th>
          <td><textarea name="crowd" id="crowd"class="admin_comdit_textarea">{yun:}$row.crowd{/yun}</textarea></td>
        </tr>
        <tr >
          <th width="120">课程优势：</th>
          <td><textarea name="superiority" id="superiority" class="admin_comdit_textarea">{yun:}$row.superiority{/yun}</textarea></td>
        </tr>
        <tr class="admin_table_trbg" >
          <th width="120">课程介绍：</th>
          <td>
 		  <script id="myEditor" name="content" type="text/plain" style="width:600px;height:220px;">{yun:}$row.content{/yun}</script>
		  </td>
        </tr>
        <tr >
          <th width="120">开课类型：</th>
          <td> 
				<div class="layui-form-item">
		        <div class="layui-input-block">
		          {yun:}foreach item=v from=$subject_type_index{/yun}
		          <input name="type[]" title="{yun:}$subject_type_name[$v]{/yun}" value="{yun:}$v{/yun}" {yun:}if in_array($v,$row.type){/yun} checked="checked" {yun:}/if{/yun} type="checkbox">
				  {yun:}/foreach{/yun}
		      </div>
			</td>
        </tr>
        <tr >
          <th width="120">课程讲师：</th>
          <td> 
			<div class="layui-form-item">
		        <div class="layui-input-block">
		          {yun:}foreach item=v from=$teachinfo{/yun}
		          <input name="teachid[]" title="{yun:}$v.name{/yun}" value="{yun:}$v.id{/yun}" {yun:}if in_array($v.id,$row.teachid){/yun} checked="checked" {yun:}/if{/yun} type="checkbox">
		        {yun:}/foreach{/yun}
		        
		        </div>
		      </div>
			</td>
        </tr>
        <tr class="admin_table_trbg" >
          <th width="120">课程缩略图：</th>
          <td>
		  <button type="button" class="yun_bth_pic adminupload" lay-data="{name: 'pic',imgid: 'imgicon',parentid: 'imgparent'}">上传图片</button>
			<input type="hidden" id="layupload_type" value="2"/>
			<input type="hidden" id="upload_path" value="subject"/>
			<input type="hidden" name="pic" value="{yun:}$row.pic{/yun}"/>
            最佳尺寸120*80 </td>
        </tr>
		<tr id="imgparent" {yun:}if !$row.pic{/yun}class="none"{yun:}/if{/yun}>
          <th width="120">预览图片：</th>
          <td><img id="imgicon" src="{yun:}$config.sy_weburl{/yun}/{yun:}$row.pic{/yun}" width="120" height="80" /></td>
        </tr>
        <tr class="admin_table_trbg" >
          <th width="120"></th>
          <td>
            <input type="hidden" name="id" size="40" value="{yun:}$row.id{/yun}"/>
            <input class="layui-btn layui-btn-normal" type="button" onclick="checkpost()" value="&nbsp;更 新&nbsp;"  />
            <input class="layui-btn layui-btn-normal" type="reset" name="reset" value="&nbsp;重 置 &nbsp;" />
            </td>
        </tr>
      </table>
    </form>
  </div>
</div>
<script type="text/javascript">
var weburl="{yun:}$config.sy_weburl{/yun}";
var form ,
	url1 = weburl+"/index.php?m=ajax&c=get_subject_option";

  layui.use(['layer', 'form'], function(){
   form = layui.form;
   var $ = layui.$;

   form.on('select(fz_type)', function(data){
      if(data.value == 1){
        $("#fz_type_1").show();
        $("#fz_type_2").hide();
      }else{
        $("#fz_type_2").show();
        $("#fz_type_1").hide();
      }
    });
	 form.on('select(nid)', function(data){
      $.post(url1,{tnid : data.value},function(html){
        $("#tnid").html(html);
        form.render();
      });
    });
  });//end layui.use()

 UE.getEditor('myEditor',{
	toolbars:[['Source', 'Bold', 'italic', 'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright','insertorderedlist', 'insertunorderedlist','emotion','simpleupload']],
	wordCount:false,
    elementPathEnabled:false,
    initialFrameHeight:180
});
</script>
<script language=javascript src='{yun:}$config.sy_weburl{/yun}/data/plus/city.cache.js?v={yun:}$config.cachecode{/yun}'></script>
<script language=javascript src='{yun:}$config.sy_weburl{/yun}/js/city.js?v={yun:}$config.cachecode{/yun}'></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui.upload.js?v={yun:}$config.cachecode{/yun}" type='text/javascript'></script>
</body>
</html>